Skip to content

Conversation

@iskettaneh
Copy link
Contributor

This PR adds the following test-only assertions:

  1. Generated batches don't touch store-local keys.
  2. Generated batches don't touch unreplicated RangeID local keys.

We disable the check in exactly 3 locations we know that we currently
touch those keys.

Fixes: #156537

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@iskettaneh iskettaneh force-pushed the rse3 branch 2 times, most recently from 9f7f91b to ed7f5cd Compare November 11, 2025 02:33
@iskettaneh iskettaneh requested a review from pav-kv November 11, 2025 02:33
@iskettaneh iskettaneh marked this pull request as ready for review November 11, 2025 02:34
@iskettaneh iskettaneh requested a review from a team as a code owner November 11, 2025 02:34
@iskettaneh iskettaneh force-pushed the rse3 branch 2 times, most recently from 4d115e0 to 4fbc791 Compare November 11, 2025 20:47
@github-actions
Copy link

Potential Bug(s) Detected

The three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation.

Next Steps:
Please review the detailed findings in the workflow run.

Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary.

After you review the findings, please tag the issue as follows:

  • If the detected issue is real or was helpful in any way, please tag the issue with O-AI-Review-Real-Issue-Found
  • If the detected issue was not helpful in any way, please tag the issue with O-AI-Review-Not-Helpful

@github-actions github-actions bot added the o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only. label Nov 11, 2025
@github-actions
Copy link

Potential Bug(s) Detected

The three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation.

Next Steps:
Please review the detailed findings in the workflow run.

Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary.

After you review the findings, please tag the issue as follows:

  • If the detected issue is real or was helpful in any way, please tag the issue with O-AI-Review-Real-Issue-Found
  • If the detected issue was not helpful in any way, please tag the issue with O-AI-Review-Not-Helpful

@iskettaneh iskettaneh force-pushed the rse3 branch 2 times, most recently from f9daad1 to cdb4edc Compare November 12, 2025 14:35
Comment on lines 91 to 93
forbiddenSpansMatchers []func(roachpb.Span) error
allowUndeclared bool
allowForbidden bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-existing, but made stronger in this PR: it seems that this type shouldn't mix the job of representing a set of spans and that of [test-only] verifying it / forbidding keys. There seems to be a clear subset of methods that add/canonicalize/access spans without having an opinion on them, and then the "check" methods that verify stuff. I would make the latter the responsibility of a wrapper (either existing one like spanSetBatch, or make a new one).

Ideally need a prereq PR/commit that does that separation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do it in another PR

@iskettaneh iskettaneh force-pushed the rse3 branch 2 times, most recently from 6f5f0a9 to 8193ffc Compare November 19, 2025 00:08
@iskettaneh iskettaneh requested a review from pav-kv November 19, 2025 00:08
Copy link
Contributor Author

@iskettaneh iskettaneh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @pav-kv)

Comment on lines 91 to 93
forbiddenSpansMatchers []func(roachpb.Span) error
allowUndeclared bool
allowForbidden bool
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do it in another PR

Copy link
Collaborator

@pav-kv pav-kv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nearing the LGTM, thanks for making it cleaner each time.

Copy link
Contributor Author

@iskettaneh iskettaneh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @pav-kv)

@iskettaneh iskettaneh requested a review from pav-kv November 19, 2025 20:06
Copy link
Contributor Author

@iskettaneh iskettaneh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @pav-kv)

Copy link
Contributor Author

@iskettaneh iskettaneh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @pav-kv)

Copy link
Collaborator

@pav-kv pav-kv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-test parts LGTM, minor suggestions. Request to clean up the tests a bit, so that I can make a final (self-convincing) pass on them and LGTM tomorrow.

Comment on lines 770 to 771
// TODO(ibrahim): The fields spans, spansOnly, and ts don't seem to be used.
// Consider removing them and performing the necessary clean ups.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or making them used as intended

Copy link
Collaborator

@pav-kv pav-kv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this change! Some last suggestions included, apply as many as makes sense.

@iskettaneh
Copy link
Contributor Author

Thank you for the detailed review Pavel!

bors r+

craig bot pushed a commit that referenced this pull request Nov 21, 2025
157153: spanset: assert that batches don't access store local and unreplicated RangeID local keys r=iskettaneh a=iskettaneh

This PR adds the following test-only assertions:
1) Generated batches don't touch store-local keys.
2) Generated batches don't touch unreplicated RangeID local keys.

We disable the check in exactly 3 locations we know that we currently
touch those keys.

Fixes: #156537

Release note: None

Co-authored-by: iskettaneh <[email protected]>
@craig
Copy link
Contributor

craig bot commented Nov 21, 2025

Build failed:

This commit introduces the concept of forbidden spans, which will
allow us to assert our batches don't modify Raft's engine keys.
Analogous to how we have a spanset helper contains() that
understands the special span representation: [x-eps,x).
This commit adds Overlaps that expects the same span
representation.

Moreover, this commit makes this special span representation
explicit by introducing a new type called `TrickySpan`.
…d RangeID local keys

This commit adds the following test-only assertions:
1) Generated batches don't touch store-local keys.
2) Generated batches don't touch unreplicated RangeID local keys.

We disable the check in exactly 2 locations we know that we currently
touch those keys.
@iskettaneh
Copy link
Contributor Author

bors r+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kvserver: assert on log engine keys in eval

3 participants